<template>
	<view class="content">
		<uni-list-item 
			class="single-line"
			showArrow
			:title="onSelectFriend() ? '' : '选择同行人'"
			thumb="/static/release/icon_xztxr.png"
			:rightText="onSelectFriend() ? onSelectFriend() : '好友列表'" 
			:clickable="true"
			@click="openAllPerson()"
		/>
		<view class="release-content">
			<textarea
				auto-height
				class="custom-input"
				v-model="content"
				:maxlength="-1"
				@input="handleTextarea"
				@focus="handleTextareaFocus"
				@blur="handleTextareaBlur"
				:adjust-position="false"
				placeholder="分享此刻的想法..."
			></textarea>
			
			<u-upload
				v-if="acceptType === 'image'"
				:fileList="fileList"
				:maxCount="10"
				:previewFullImage="true"
				name="editPostImages"
				ref="uUploadImage"
				multiple
				width="100"
				height="100"
				:accept="acceptType"
				@afterRead="handleImageUpload"
				@delete="deletePic"
			>
				<view class="upload">
					<u-icon class="slot-icon" name="plus" color="#999999" size="30"></u-icon>
					<view>照片/视频</view>
				</view>
			</u-upload>
			<u-upload
				v-if="acceptType === 'video'"
				:fileList="videoList"
				:maxCount="1"
				:previewFullImage="true"
				name="editPostVideo"
				ref="uUploadVideo"
				:deletable="true" 
				width="100"
				height="100"
				:accept="acceptType"
				@afterRead="handleVideoUpload"
				@delete="deleteVideoPic" 
			>
				<view class="upload">
					<u-icon class="slot-icon" name="plus" color="#999999" size="30"></u-icon>
					<view>照片/视频</view>
				</view>
			</u-upload>

			<view class="tag-btn" @click="showTagList = !showTagList">
				#话题
			</view>
			 
			<view v-if="showTagList && availableTags.length" class="tag-list">
			  <view 
				v-for="(tag) in availableTags" 
				:key="tag.topicId" 
				class="tag-item"
				@click="insertTag(tag)"
			  >
				#{{ tag.title }}
			  </view>
			</view>
			<uni-list style="margin-top: 50rpx;border-top: 1rpx solid #e5e5e5;" :border="false">
				<uni-list-item
					:clickable="true"
					title="获取位置" 
					showArrow
					thumb="/static/release/icon_dw.png"
					thumb-size="sm"
					:rightText="locationInfo && locationInfo.name ? locationInfo.name : '定位让更多人能看到你~'" 
					@click="onPlace()"
				/>
				<uni-list-item
					:clickable="true"
					:border="false"
					title="谁可以看" 
					showArrow
					thumb="/static/release/icon_skyk.png"
					thumb-size="sm"
					:rightText="powerObject.label" 
					@click="onPower()"
				/>
				<uni-list-item
					:clickable="true"
					:border="false"
					title="自定义发布时间" 
					showArrow
					thumb="/static/release/icon_skyk.png" 
					thumb-size="sm"
					:rightText="formatDateForDisplay(releaseTime) || '选择发布时间'" 
					@click="dateShow=true"
				/>
			</uni-list>
		</view>
		<u-datetime-picker
			:show="dateShow"
			v-model="pickerTime"
			:minDate="473356800000"
			mode="date"
			@cancel="dateShow=false"
			@confirm="confirmDateTime"
		>
		</u-datetime-picker>
		<view class="tabbar-container">
			<view class="btn">
				<u-button shape="circle" @click="onUpdatePost" :loading="isSubmitting" loadingText="正在更新" :disabled="isSubmitting || isLoading || isUploadingGlobally" text="确认修改" color="#FFB327"></u-button>
			</view>
		</view>
		<u-picker 
			:show="showPower" 
			:columns="powerColumns" 
			keyName="label"
			@confirm="onConfirmPower"
			@cancel="showPower = false"
		></u-picker>
		<QianziyuSelect
			:show="showAllCompanions" 
			type="checkbox"
			:showSearch="false"
			:popupTitle="'选择同行人'" 
			name="allPerson" 
			:dataLists="availableFriendList" 
			placeholder="输入同行人名称搜索"
			@cancel="showAllCompanions=false" 
			@submit="onFriendsSelected"
		></QianziyuSelect>
		<u-loading-page :loading="isLoading || isUploadingGlobally" :loading-text="loadingText"></u-loading-page>
	</view>
</template>

<script>
	import NavBar from '@/components/common-nav/common-nav.vue';
	import QianziyuSelect from '@/components/qianziyu-select/qianziyu-select.vue';
	import { getTopicsList, getFriendsList, getQiniuToken, publishPost, getPostDetails, updatePost, revokeFile } from '@/request/api.js';

	const POST_IMAGE_PURPOSE = 'post_image';
	const POST_VIDEO_PURPOSE = 'post_video';
	const MAX_VIDEO_SIZE_MB = 100;
	const MAX_VIDEO_SIZE_BYTES = MAX_VIDEO_SIZE_MB * 1024 * 1024;

	export default {
		components: {
			NavBar,
			QianziyuSelect
		},
		data() {
			return {
				isLoading: false, // Initially false, set to true if re-fetching
				isUploadingGlobally: false,
				loadingText: '加载中...',
				isSubmitting: false,
				postId: null,
				content: "",
				acceptType: "image", 
				fileList: [], 
				videoList: [], 
				initialFilesFromServer: [], 

				showTagList: false,
				availableTags: [],
				selectedTagList: [], 
				cursorPos: 0,

				showPower: false,
				powerColumns: [[
					{ label: '所有人可见', id: 1 },
					{ label: '仅朋友可见', id: 2 },
					{ label: '私密·仅自己可见', id: 0 }
				]],
				powerObject: { label: '所有人可见', id: 1 },
				
				showAllCompanions: false,
				availableFriendList: [],
				selectedFriends: [], 
				
				locationInfo: null,
				
				dateShow: false,
				pickerTime: Number(new Date()), 
				releaseTime: null, 

				uploadToken: null,
				uploadKey: null,
				eventChannel: null,
			};
		},
		onLoad(options) {
			this.eventChannel = this.getOpenerEventChannel();
			if (this.eventChannel && this.eventChannel.on) {
				this.eventChannel.on('acceptDataFromOpenerPage', (res) => {
					if (res && res.data) {
						console.log("res.data",res.data);
						this.initializePageWithData(res.data);
					} else {
						uni.showToast({ title: '加载帖子数据失败', icon: 'error' });
						uni.navigateBack();
					}
				});
			} else { 
                // Fallback if eventChannel is not available or no data passed (e.g., direct navigation for testing)
                // This part should ideally not be hit in normal flow from timeline
				if (options.postId) {
					this.postId = options.postId;
					this.loadPostDetailsFromServer(); // Renamed for clarity
				} else {
					uni.showToast({ title: '无效的帖子ID', icon: 'error' });
					uni.navigateBack();
					return;
				}
			}
			this.getTagList();
			this.getFriendsList();
		},
		methods: {
            initializePageWithData(post) {
                this.isLoading = true; // Indicate loading while processing
                this.loadingText = '处理帖子数据...';

                this.postId = post.id;
                this.content = post.content || "";
                
                const hasFiles = post.files && post.files.length > 0;
                this.acceptType = hasFiles && post.files[0].isImage === 0 ? 'video' : 'image';
                
                this.initialFilesFromServer = hasFiles ? post.files.map(f => ({ 
                    id: f.id, 
                    url: f.fileUrl, 
                    qiniuKey: f.qiniuKey, 
                    isImage: f.isImage, 
                    originalName: f.fileName,
                    status: 'success',
                    isNew: false 
                })) : [];

                if (this.acceptType === 'image') {
                    this.fileList = [...this.initialFilesFromServer];
                } else {
                    this.videoList = [...this.initialFilesFromServer];
                }

                if(post.location){
                    const locParts = post.location.split('-');
                    this.locationInfo = {
                        name: locParts[locParts.length - 1] || '未知地点', 
                        address: post.location, 
                        latitude: post.latitude, 
                        longitude: post.longitude,
                        province: post.province || '',
                        city: locParts.length > 1 ? locParts[0] : ''
                    };
					console.log("locationInfo",this.locationInfo);
                } else {
                    this.locationInfo = null;
                }
                
                const power = this.powerColumns[0].find(p => p.id === post.visibility);
                this.powerObject = power || { label: '所有人可见', id: 1 };
                
                this.releaseTime = post.travelDate ? new Date(post.travelDate).getTime() : null;
                if (this.releaseTime) {
                   this.pickerTime = this.releaseTime;
                }

                this.selectedTagList = post.postTopics ? post.postTopics.map(t => ({ topicId: t.topicId, title: t.title })) : [];
                
                this.selectedFriends = post.fellows ? post.fellows.map(f => ({ id: f.userId, name: f.nickName, avatar: f.avatar })) : [];
                
                this.isLoading = false; // Done processing
            },

            // Renamed from loadPostDetails for clarity when it's a fallback
            async loadPostDetailsFromServer() { 
                this.isLoading = true;
                this.loadingText = '加载帖子详情...';
                try {
                    const res = await getPostDetails(this.postId);
                    if (res.data && res.data.code === 200 && res.data.data) {
                        this.initializePageWithData(res.data.data);
                    } else {
                        uni.showToast({ title: res.data.msg || '加载帖子失败', icon: 'error' });
                    }
                } catch (error) {
                    uni.showToast({ title: '请求帖子详情失败', icon: 'error' });
                } finally {
                    this.isLoading = false;
                }
            },
			generateQiniuToken(originalFilename, purpose){
				return new Promise((resolve, reject) => {
					let params = { originalFilename, purpose };
					getQiniuToken(params).then(res => {
						if (res.data && res.data.data && res.data.data.token) {
							this.uploadToken = res.data.data.token;
							this.uploadKey = res.data.data.key;
							resolve(true);
						} else {
							reject(new Error('获取上传凭证失败'));
						}
					}).catch(err => reject(err));
				});
			},

			uploadFileToQiniu(fileUrl) {
				return new Promise((resolve, reject) => {
					uni.uploadFile({
						url: this.$store.state.qiNiuUploadUrl,
						filePath: fileUrl,
						name: "file",
						formData: { token: this.uploadToken, key: this.uploadKey },
						success: (res) => {
							try {
								const data = JSON.parse(res.data);
								resolve(`${this.$store.state.ossBaseUrl}/${data.key}`);
							} catch (e) { reject(new Error('上传响应解析错误')); }
						},
						fail: (err) => reject(err)
					});
				});
			},

			async handleImageUpload(event) {
				this.isUploadingGlobally = true; this.loadingText = '图片上传中...';
				let lists = [].concat(event.file);
				const startIndex = this.fileList.length;

				const newPlaceholders = lists.map(item => ({
					url: item.url, status: "", message: "", originalName: item.name || `image_${Date.now()}.jpg`,
					mimeType: item.type || 'image/jpeg', qiniuKey: null, _tempPath: item.url, isNew: true
				}));
				this.fileList.push(...newPlaceholders);

				const uploadPromises = newPlaceholders.map(async (placeholder, index) => {
					const actualFileIndex = startIndex + index;
					try {
						// const compressedUrl = await this.compressImage(placeholder._tempPath);
						await this.generateQiniuToken(placeholder.originalName, POST_IMAGE_PURPOSE);
						const qiniuCdnUrl = await this.uploadFileToQiniu(placeholder._tempPath);
						this.$set(this.fileList[actualFileIndex], 'url', qiniuCdnUrl);
						this.$set(this.fileList[actualFileIndex], 'status', 'success');
						this.$set(this.fileList[actualFileIndex], 'qiniuKey', this.uploadKey);
					} catch (error) {
						this.$set(this.fileList[actualFileIndex], 'status', 'fail');
						this.$set(this.fileList[actualFileIndex], 'message', '上传失败');
					}
				});
				await Promise.all(uploadPromises).finally(() => { this.isUploadingGlobally = false; });
			},

			async handleVideoUpload(event) {
				this.isUploadingGlobally = true; this.loadingText = '视频上传中...';
				let fileItem = [].concat(event.file)[0];
				const fileSize = fileItem.size || (fileItem.file ? fileItem.file.size : 0);

				if (fileSize > MAX_VIDEO_SIZE_BYTES) {
					uni.showToast({ title: `视频文件最大支持${MAX_VIDEO_SIZE_MB}MB`, icon: 'none' });
					this.videoList = [{ url: fileItem.url, status: 'fail', message: `超过${MAX_VIDEO_SIZE_MB}MB限制`, isNew: true }];
					this.isUploadingGlobally = false; 
					return;
				}
				const originalName = fileItem.name || `video_${Date.now()}.mp4`;
				const videoObject = {
					url: fileItem.url, status: '', message: '', originalName,
					mimeType: fileItem.type || 'video/mp4', qiniuKey: null, isNew: true
				};
				this.videoList = [videoObject];
				try {
					const compressedUrl = await this.compressVideo(fileItem.url);
					await this.generateQiniuToken(originalName, POST_VIDEO_PURPOSE);
					const qiniuCdnUrl = await this.uploadFileToQiniu(compressedUrl);
					this.$set(this.videoList[0], 'url', qiniuCdnUrl);
					this.$set(this.videoList[0], 'status', 'success');
					this.$set(this.videoList[0], 'qiniuKey', this.uploadKey);
				} catch (error) {
					this.$set(this.videoList[0], 'status', 'fail');
					this.$set(this.videoList[0], 'message', '上传失败');
				} finally {
					this.isUploadingGlobally = false;
				}
			},
            compressImage(url){ 
				return new Promise((resolve, reject) => {
					uni.getImageInfo({
						src: url,
						success: (res) => {
						    const ratio = res.width / res.height;
						    const maxWidth = 1000; 
						    uni.compressImage({
								src: url,
								quality:100,
								compressedWidth: res.width > maxWidth ? maxWidth : res.width,
								compressedHeight: res.width > maxWidth ? Math.round(maxWidth/ratio) : res.height,
								success: (cres) => {
									resolve(cres.tempFilePath);
								},
								fail: (err) => {
									resolve(url); 
								}
						    })
						},
                        fail: (err) => {
                            resolve(url); 
                        }
					});
				});
			},
            compressVideo(url) { 
				return new Promise((resolve, reject) => {
					uni.getVideoInfo({
						src: url,
						success: (info) => {
							const maxBitrate = 4096; 
							const targetBitrate = Math.min(info.bitrate || 5000, maxBitrate); 
							let resolutionRatio = 1;
                            if (info.width && info.height && info.width * info.height > 0) { 
                                resolutionRatio = Math.min(1, Math.sqrt((1280*720)/(info.width*info.height))); 
                            }
							
							const systemInfo = uni.getSystemInfoSync();
							const quality = systemInfo.platform === 'android' ? "high" : "high";
							uni.compressVideo({
								src: url, 
								quality: quality,            
								bitrate: targetBitrate,        
								resolution: resolutionRatio,   
								fps: Math.min(info.fps || 30, 30),  	
								success: (res) => {
									resolve(res.tempFilePath);
								},
								fail: (err) => {
									uni.showToast({ title: '视频压缩失败，尝试使用原视频', icon: 'none' });
                                    resolve(url); 
								}
							});
						},
                        fail: (err) => {
                            uni.showToast({ title: '获取视频信息失败，尝试使用原视频', icon: 'none' });
                            resolve(url); 
                        }
					});
				});
			},

			deletePic(event) {
                this.fileList.splice(event.index, 1);
			},
			deleteVideoPic(event) {
                this.videoList.splice(event.index, 1);
			},

			handleTextarea(e) { this.content = e.detail.value; this.cursorPos = e.detail.cursor; },
            handleTextareaFocus() {  },
            handleTextareaBlur() { setTimeout(() => {  }, 200); },
			getTagList() { 
                getTopicsList({ pageNum: 1, pageSize: 10 }).then(res => {
                    if (res.data && res.data.rows) {
                        this.availableTags = res.data.rows.map(item => ({ topicId: item.topicId, title: item.title }));
                    }
                });
            },
			insertTag(tag) { 
                const currentSelection = this.selectedTagList.find(t => t.topicId === tag.topicId);
                if (!currentSelection) {
                    this.selectedTagList.push(tag);
                }
				const newText = this.content.slice(0, this.cursorPos) + `#${tag.title} ` + this.content.slice(this.cursorPos);
				this.content = newText;
				this.showTagList = false;
            },
			getFriendsList() {
                getFriendsList().then(res => {
                    let list = [];
                    if (res.data && res.data.data && res.data.data.groupedArray) {
                        res.data.data.groupedArray.forEach(group => {
                            list.push(...group.map(i => ({ id: i.userId, name: i.nickName, avatar: i.avatar || '' })));
                        });
                    }
                    this.availableFriendList = list;
                });
            },
			openAllPerson() { this.showAllCompanions = true; },
			onSelectFriend() {
                if (!this.selectedFriends || this.selectedFriends.length === 0) return false;
                return this.selectedFriends.map(p => p.name).join('、 ');
            },
			onFriendsSelected(e) { this.selectedFriends = e; this.showAllCompanions = false; },
			onPlace() {
                uni.chooseLocation({
					success: res => {
						this.locationInfo = { ...res, province: '', city: '' };
                        this.handleAddress(); 
					}
				});
            },
            handleAddress(){ 
				if (!this.locationInfo) {
				    this.locationInfo = {};
				}
				if (typeof this.locationInfo.address !== 'string') {
				    this.locationInfo.address = "";
				}
				
				this.locationInfo.province = "";
				this.locationInfo.city = "";
				
				const addressStr = this.locationInfo.address;
				
				if (addressStr) {
				    let provinceEndIndex = addressStr.indexOf("省");
				
				    if (provinceEndIndex === -1) {
				        provinceEndIndex = addressStr.indexOf("市");
				        if (provinceEndIndex === -1) {
				            let autoRegionIndex = addressStr.indexOf("自治区");
				            if (autoRegionIndex !== -1) {
				                provinceEndIndex = autoRegionIndex + 2;
				            }
				        }
				    }
				
				    let extractedProvince = "";
				    if (provinceEndIndex !== -1) {
				        extractedProvince = addressStr.slice(0, provinceEndIndex + 1);
				    } else {
				        extractedProvince = addressStr;
				    }
				    this.locationInfo.province = extractedProvince;
				
				    let extractedCity = "";
				    const provinceName = this.locationInfo.province;
				
				    const directMunicipalities = ["北京市", "上海市", "天津市", "重庆市"];
				
				    if (directMunicipalities.includes(provinceName)) {
				        extractedCity = provinceName;
				    } else {
				        let searchTargetForCity = addressStr;
				
				        if (provinceName &&
				            (provinceName.endsWith("省") || provinceName.endsWith("自治区")) &&
				            addressStr.startsWith(provinceName)) {
				            searchTargetForCity = addressStr.substring(provinceName.length);
				        }
				
				        const cityRegex = /^(?:(.*?自治州)|(.*?地区)|(.*?市)|(.*?盟))/;
				        const cityMatch = searchTargetForCity.match(cityRegex);
				
				        if (cityMatch) {
				            extractedCity = cityMatch[1] || cityMatch[2] || cityMatch[3] || cityMatch[4] || "";
				        } else if (provinceName && provinceName.endsWith("市") &&
				                   !provinceName.endsWith("省") && !provinceName.endsWith("自治区") &&
				                   !directMunicipalities.includes(provinceName)) {
				            extractedCity = provinceName;
				        }
				    }
				    this.locationInfo.city = extractedCity;
				}
			},
			onPower() { this.showPower = true; },
			onConfirmPower(e) { this.powerObject = e.value[0]; this.showPower = false; },
            confirmDateTime(e) { 
                this.releaseTime = e.value; // Store as timestamp
                this.pickerTime = e.value; 
                this.dateShow = false; 
            },
			formatDateForDisplay(timestamp) { 
                if(!timestamp) return null;
				const date = new Date(timestamp);
			    let year = date.getFullYear();
			    let month = ("0" + (date.getMonth() + 1)).slice(-2);
			    let day = ("0" + date.getDate()).slice(-2);
				return `${year}-${month}-${day}`;
            },
            formatDateForApi(timestamp) { // For sending to API
                if(!timestamp) return null;
				const date = new Date(timestamp);
			    let year = date.getFullYear();
			    let month = ("0" + (date.getMonth() + 1)).slice(-2);
			    let day = ("0" + date.getDate()).slice(-2);
				return `${year}-${month}-${day}`;
            },
			onLeftIcon() { uni.navigateBack(); },

			async onUpdatePost() {
				this.isSubmitting = true;
				const currentUserId = this.$store.state.userInfo.userId;

				const currentMediaFiles = (this.acceptType === 'image' ? this.fileList : this.videoList)
					.filter(item => item.status === 'success' && item.url);

				const filesToSubmit = currentMediaFiles.map(item => ({
					id: item.isNew ? null : item.id, 
					userId: currentUserId,
					fileName: item.originalName,
					fileUrl: item.url,
					fileType: item.mimeType || (this.acceptType === 'image' ? 'image/jpeg' : 'video/mp4'),
					isImage: this.acceptType === 'image' ? 1 : 0,
					qiniuKey: item.qiniuKey || null
				}));
				
				const currentServerFileIds = new Set(currentMediaFiles.filter(f => !f.isNew && f.id).map(f => f.id));
				const deletedFileIds = this.initialFilesFromServer
										.filter(initialFile => !currentServerFileIds.has(initialFile.id))
										.map(initialFile => initialFile.id);


				if (filesToSubmit.length === 0 && (this.acceptType === 'image' || this.acceptType === 'video')) {
					uni.showToast({ title: `请上传${this.acceptType === 'image' ? '图片' : '视频'}`, icon: "none" });
					this.isSubmitting = false;
					return;
				}

				let params = {
					id: this.postId, 
					files: filesToSubmit,
                    // deletedFileIds: deletedFileIds, 
					content: this.content,
					userId: currentUserId,
					contentType: 2,
					location: this.locationInfo ? `${this.locationInfo.province}-${this.locationInfo.city}-${this.locationInfo.name}` : (this.initialPostData && this.initialPostData.location || null),
					longitude: this.locationInfo ? this.locationInfo.longitude : (this.initialPostData && this.initialPostData.longitude || null),
					latitude: this.locationInfo ? this.locationInfo.latitude : (this.initialPostData && this.initialPostData.latitude || null),
					visibility: this.powerObject.id,
					topicIds: this.selectedTagList.map(item => item.topicId),
					followsUserIds: this.selectedFriends.map(item => item.id),
					travelDate: this.releaseTime ? this.formatDateForApi(this.releaseTime) : null
				};
				console.log("params",params);
				// return
				try {
					const res = await updatePost(params); 
					if (res.data && (res.data.code === 200 || res.data.success || !res.data.code)) {
						uni.showToast({ title: '帖子更新成功' });
						
						// Notify previous page (Timeline)
						const pages = getCurrentPages();
						if (pages.length >= 2) {
							const prevPage = pages[pages.length - 2];
							if (prevPage && prevPage.$vm && typeof prevPage.$vm.handleRefresh === 'function') {
								prevPage.$vm.handleRefresh({source: 'editPost', postId: this.postId });
							}
						}
						setTimeout(() =>{
							uni.reLaunch({
								url:"/pages/tabBar/time-axis/time-axis",
							})
						}, 500);
					} else {
						uni.showToast({ title: res.data.msg || '更新失败', icon: 'none' });
					}
				} catch (error) {
					uni.showToast({ title: '更新请求失败', icon: 'none' });
				} finally {
					this.isSubmitting = false;
				}
			}
		}
	};
</script>

<style lang="scss" scoped>
	.custom-input {
		width: 100%;
		min-height: 150rpx; 
		padding: 20rpx 0;
		font-size: 32rpx;
		line-height: 1.5;
		border-radius: 16rpx;
		transition: all 0.3s;
		box-sizing: border-box;
	}
	
	.custom-input:focus {
		border-color: #007AFF;
		background: #fff;
		box-shadow: 0 4rpx 12rpx rgba(0,122,255,0.1);
	}
	.tag-btn{
		background: #f8f8f8;
		width: auto; 
        padding: 10rpx 20rpx; 
		text-align: center;
		font-size: 26rpx;
		letter-spacing: 1rpx;
		border-radius: 50rpx;
		color: #23232A;
        display: inline-block; 
        margin-top: 10rpx; 
	}
	.tag-list {
		position: relative; 
		max-height: 300rpx; 
		overflow-y: auto;
		border: 1px solid #e5e5e5;
        border-radius: 8rpx;
        margin-top: 10rpx;
        background-color: #fff;
        z-index: 10; 
	}
	.tag-item {
		padding: 15rpx 20rpx;
		border-bottom: 1px solid #f5f5f5;
		&:last-child {
			border-bottom: none;
		}
		&:active {
			background: #f0f0f0;
		}
	}
	page {
		background-color: #F8F8F8;
	}
	.content{
		padding-top: 53rpx!important;
		padding-left: 20rpx;
		padding-right: 20rpx;
        padding-bottom: 150rpx; 
		.single-line {
			width: 100%;          
			white-space: nowrap;   
			overflow: hidden;      
			text-overflow: ellipsis; 
			border-radius: 20rpx;
			flex: 1;
			background-color: #FFFFFF!important; 
			::v-deep .uni-list-item__container { 
				padding-top: 20rpx !important;
				padding-bottom: 20rpx !important;
			}
		}
	}
	.release-content{
		padding:  20rpx 20rpx 40rpx 20rpx;
		margin-top: 20rpx;
		background-color: #FFFFFF!important;
		border-radius: 30rpx;
		.upload{
			width: 100px;
			height: 100px;
			background: #F8F8F8;
			color: #7C7B7B;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			font-size: 26rpx;
			border-radius: 20rpx;
		}
	}
	.tabbar-container {
		width: 100%; 
		position: fixed;
		left: 0;
		bottom: 0;
		display: flex;
		align-items: center;
		padding: 20rpx;
		background-color: #FFFFFF;
		box-sizing: border-box; 
		z-index: 99; 
		.icon{
			width: 50rpx;
            margin-bottom: 5rpx; 
		}
		.fc{
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center; 
			width: 120rpx; 
			color: #989898;
			letter-spacing: 1rpx; 
			font-size: 22rpx; 
            height: 100rpx; 
		}
		.btn{
			flex: 1;
			// margin-left: 20rpx; // No need for margin if it's the only button
			display: flex; 
			align-items: center;
			justify-content: center;
			::v-deep .u-button { 
				width: 100%;
				height: 80rpx; 
				font-size: 30rpx; 
			}
		}
	}
</style>